/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.given.designpatterns.creational.factorymethod.factory;

import za.ac.cput.given.designpatterns.creational.factorymethod.Animal;
import za.ac.cput.given.designpatterns.creational.factorymethod.Impl.Cat;
import za.ac.cput.given.designpatterns.creational.factorymethod.Impl.Dog;

/**
 *
 * @author staff
 */
public class AnimalFactory {
    private static AnimalFactory  animalFactory = null;

    public static AnimalFactory getAnimalFactoryInstance() {
        if(animalFactory == null){
            animalFactory = new AnimalFactory();
        }
        return animalFactory;
    }
    
    private AnimalFactory(){        
    }

    public Animal getAnimal(String type) {
        if ("canine".equals(type)) {
            return new Dog();
        } else {
            return new Cat();
        }
    }
}
